/**
 * 表单相关数据
 */

//表单数据对象
let formData = {
  dtype: { text: null, value: null },
  pstate: { text: null, value: null },
  declarant: { text: null, value: null },
  collector: { text: null, value: null },
  partner: { text: null, value: null },
  addTime: { text: null, value: null },
  householdType: { text: null, value: null },
  marriage: { text: null, value: null },
  contactName: { text: null, value: null },
  telephone: { text: null, value: null },
  mobilephone: { text: null, value: null },
  nursingHouse: { text: null, value: null },
  nonfarmEconomy: { text: null, value: null },
  nonfarmHousing: { text: null, value: null },
  farmEconomy: { text: null, value: null },
  farmHousing: { text: null, value: null },
  literacy: { text: null, value: null },
  education: { text: null, value: null },
  generalSchool: { text: null, value: null },
  specialSchool: { text: null, value: null },
  notEnrolledReason: { text: null, value: null },
  employ: { text: null, value: null },
  employType: { text: null, value: null },
  unemployedIncome: { text: null, value: null },
  unemployedReason: { text: null, value: null },
  employAssist: [],
  employAssistNeed: [],
  socialInsurance: [],
  endowmentInsurance: { text: null, value: null },
  endowmentSubsidy: { text: null, value: null },
  medicalInsurance: { text: null, value: null },
  medicalSubsidy: { text: null, value: null },
  socialAssist: [],
  socialWelfare: [],
  foster: { text: null, value: null },
  fosterNeed: { text: null, value: null },
  familyDoctor: { text: null, value: null },
  sick: { text: null, value: null },
  sickCure: { text: null, value: null },
  notCureReason: [],
  rehabilitation: [],
  noRehabilitationReason: [],
  rehabilitationNeed: [],
  barrierFree: { text: null, value: null },
  barrierFreeNeed: [],
  activity: { text: null, value: null },
  inactivityReason: [],
  collectiveHousehold: { text: null, value: null },
  hostName: { text: null, value: null },
  hostIdentityCard: { text: null, value: null },
  fileList: []
};

function toTextStr(arr, list) {
  let tempArr = [];
  if (arr == null || arr.length == 0) {
    return "";
  }
  for (let v of arr) {
    if (v) {
      tempArr.push(list[v - 1].text);
    }
  }
  tempArr.sort();
  return tempArr.join("，");
}

export default { toTextStr, formData };
